package java学习.数字马力;

import java.util.Arrays;
import java.util.Scanner;

/**
 * **************
 * 项目名称: 蓝桥杯-Java学习 <br/>
 * 文件名称:  <br/>
 * 文件描述: 这里添加您的类文件描述，说明当前文件要包含的功能。 <br/>
 * 文件创建：刘世锦Lenovo <br/>
 * 创建时间: 2022/10/15 <br/>
 *
 * @version v1.0 <br/>
 * @update [序号][日期YYYY-MM-DD][更改人姓名][变更描述]<br/>
 * *************
 */
public class 笔试 {

        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int len = sc.nextInt();
            int arr [] = new int[len];
            for (int i = 0; i < len; i++) {
                arr[i] = sc.nextInt();
            }
    //6
    //
    //  0 1 2 3 4 5
    //  1 3 5 2 4 6
            int[] dp  = new int[len];
            for (int i = 0; i < len; i++) {
                if (i>0){
                    int sum = 0;
                    for (int j = 0; j < i; j++) {
                        if (arr[j]<arr[i]){
                            sum+=arr[j];
                        }
                    }
                    dp[i] = sum;
                }
            }
            long res = 0;
            for (int i = 0; i < dp.length; i++) {
                res^=dp[i];
            }
            System.out.println(2*res+1);
//            System.out.println(res%1000000007L);
            System.out.println(Math.floorMod(res, 1000000007));

            System.out.println(Integer.MAX_VALUE); // 2147483647
            System.out.println(Integer.MAX_VALUE*2);// -2
            System.out.println(Integer.MIN_VALUE);  // -2147483648
            System.out.println(Integer.MIN_VALUE*2); // 0
            System.out.println(Integer.MAX_VALUE+ Integer.MIN_VALUE); // -1
            /**
             * 		Integer.MAX+1 = Integer.MIN.
             * 		Integer.MAX_VALUE + Integer.MIN_VALUE = -1.
             * 										两边都+ Integer.MAX
             * 		Integer.MAX_VALUE*2 = Integer.MAX_VALUE+ Integer.MAX_VALUE
             * 					  = Integer.MIN  + Integer.MAX - 1  = -1-1
             * 					  = -2.
             *
             *   	Integer.MAX+1 = Integer.MIN.
             * 		Integer.MAX_VALUE + Integer.MIN_VALUE = -1.
             * 		Integer.MIN_VALUE * 2 = 2 * (Integer.MAX + 1) = -2 +2 = 0
             */
        }

        public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String[] strings = s.split(" ");
        System.out.println(Arrays.toString(strings));
        System.out.println(strings[strings.length-1].length());

    }


        public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int res = 0;
        String s = sc.next();
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i)>='A'&&s.charAt(i)<='Z'){
                res++;
            }
        }
        System.out.println(res);
    }
}
